<%--                                                                       --%>
<%-- Copyright (c) 2001-2004 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries.                       --%>
<%--                                                                       --%>

<%@ page language="java" %>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 
<%@ taglib uri="/WEB-INF/bv-html.tld" prefix="bvhtml" %>

<script language=JavaScript>
<!--

function confirmDeleteDiscussionGroup()
{
   if (confirm('<bean:message key="cs.confirm.delete.discussion"/>'))
   {
      return true;
   }
   else
   {
      return false;
   }
}

function onClickSave() {
  if (validateForm()) {
    document.csDiscussionEditForm.submit();
  }
}

function onClickCancel(theForm) {
  theForm.action='<html:rewrite page="/cs/discussionList.do"/>';
  theForm.submit();
}
//
// Trims leading blanks.
//
function stringLeftTrim(s)
{
   return s.replace(/^ +/, "");
}

//
// Trims trailing blanks.
//
function stringRightTrim(s)
{
   return s.replace(/ +$/, "");
}

//
// Trims leading and trailing blanks.
//
function stringTrim(s)
{
   return stringRightTrim(stringLeftTrim(s));
}

//
// Validate the user's entries.
//
function validateForm() 
{
   var dgroupName = stringTrim(document.csDiscussionEditForm.name.value);

   if (dgroupName == "") 
   {
      alert('<bean:message key="cs.error.discussion.name"/>');
      return false;
   }

   var groupIndex = document.csDiscussionEditForm.groupIds.selectedIndex;

   if (groupIndex == -1)
   {
      alert('<bean:message key="cs.error.discussion.group"/>');
      return false;	
   }

   document.csDiscussionEditForm.name.value = dgroupName;
   return true;
}

// -->
</script>
<!-- Zone 5 starts here.  -->
      
<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" 
       summary="content area">
  <tr>
    <td valign="top">
    
    <!--start microsite logo and name here-->
      <div class="pageTitle">
        <%@ include file="/cs/microsite/micrositeNaviInfo.jsp" %>
      </div> 
    <!--end microsite logo and name here-->
    
    <!--start title bar here-->
    <div class="pageSubtitle">
      <span class="left">
        <logic:equal name="discussionGroupDTO" property="id" value="0">
           <bean:message key="cs.discussion.new"/>
        </logic:equal>
        <logic:notEqual name="discussionGroupDTO" property="id" value="0">
          <bean:define id="discussionName" name="discussionGroupDTO" property="name"/>      
          <bean:message key="cs.discussion.edit" arg0="<%=discussionName.toString()%>"/>
        </logic:notEqual>
      </span>
      
      <%-- display button here --%>
      <logic:notEqual name="discussionGroupDTO" property="id" value="0">
        <span class="right">
        <input type="button" onclick="if(confirmDeleteDiscussionGroup()) location='<html:rewrite page="/cs/discussionDelete.do" name="discussionGroupDTO" property="urlParams"/>';" value="<bean:message key="cs.discussion.delete"/>" class="titleButton"/>
        </span>  
      </logic:notEqual> 
    </div> 
    <!--end title bar here--> 

    <div class="blockWrap">

    <!-- start Page Instructions -->
    <div class="pageInstructions">
      <logic:equal name="discussionGroupDTO" property="id" value="0">
        <bean:message key="cs.discussion.new.note"/>
      </logic:equal>
      <logic:notEqual name="discussionGroupDTO" property="id" value="0">
         <bean:message key="cs.discussion.edit.note"/>
      </logic:notEqual>
    </div>
    <!-- End Page Instructions -->

    <!--end title bar here--> 




<!--  BEGIN form { discussion } ----------------------------- -->

<html:form action="/cs/discussionSave.do" onsubmit="return false;">

   <bvhtml:hiddenList name="micrositeNaviInfoView" property="urlParams" scope="request"/>
<!--start main content area here-->

<!--start main content area here-->
<table class="labelForm" width="100%" border="0" cellspacing="0" 
     cellpadding="0" summary="Edit Discussion Group">
    
  <tr>
    <td width=20% class="label"><bean:message key="cs.name"/>*:</td>
    <td width=80% class="labelField">
      <html:text name="csDiscussionEditForm" property="name" size="40" maxlength="80" /> 
    </td>
  </tr>
        
  <tr> 
    <td nowrap width=20% class="label" valign="top"><bean:message key="cs.groups"/>*: 
    </td>
    <td width=80% class="labelField">
      <html:select name="csDiscussionEditForm" property="groupIds" size="4" multiple="true">
        <html:optionsCollection name="discussionGroupDTO" property="groups" />
      </html:select>
    </td>
  </tr>
</table>
  	
<!--end main content area here-->

<!--start cancel, reset, save bar area here-->
    
 <div class="pageButtonWrap" align="right">
   <html:reset styleClass="pageButton" property="resetBtn" titleKey="button.reset">
     <bean:message key="button.reset"/>
   </html:reset>           
	&nbsp;&nbsp;
   <html:button styleClass="pageButton" property="resetBtn" titleKey="button.cancel"
        onclick="onClickCancel(this.form)">
     <bean:message key="button.cancel"/>
   </html:button>                    

   <html:button styleClass="pageButton" property="saveBtn" 
       titleKey="button.save" onclick="onClickSave()">
     <bean:message key="button.save" />
   </html:button>
           
 </div>
</html:form>

  </div> <!-- end of blockWrap -->

  </td>
  </tr>
</table> 
     
<!--end cancel, reset, save bar area here-->

